using System;
using System.DirectoryServices;

namespace Pegasus.DirectoryServices
{
	/// <summary>
	/// 
	/// </summary>
	public class DirectoryUserCollection : DirectoryObjectCollection< DirectoryUser >
	{
		/// <summary>
		/// Initializes a new instance of the <see cref="T:DirectoryUserCollection"/> class.
		/// </summary>
		internal DirectoryUserCollection()
		{
		}

		/// <summary>
		/// Initializes a new instance of the <see cref="T:DirectoryUserCollection"/> class.
		/// </summary>
		internal DirectoryUserCollection( SearchResultCollection searchResults )
		{
			AddSearchResult( searchResults );
		}

		/// <summary>
		/// Adds the search result to the collection.
		/// </summary>
		/// <param name="searchResults">The search results.</param>
		internal void AddSearchResult( SearchResultCollection searchResults )
		{
			foreach( SearchResult item in searchResults )
			{
				Add( new DirectoryUser( item.GetDirectoryEntry() ) );
			}
		}
	}
}
